package com.xr.singleton.config;

import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
import com.baomidou.mybatisplus.extension.plugins.PerformanceInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class MybatisPlusConfig {

    @Bean
    public PerformanceInterceptor performanceInterceptor(){
        PerformanceInterceptor performance = new PerformanceInterceptor();
        performance.setMaxTime(1000);
        performance.setFormat(true);
        return  performance;
    }

    /**
     * 分页插件
     * @return
     */
    @Bean
    public PaginationInterceptor paginationInterceptor(){
        PaginationInterceptor pagination = new PaginationInterceptor();
        pagination.setDialectType("mysql");
        return pagination;
    }

}
